<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>全局函数重点练习</title>
    <script>
        var test = "张三";
        //两种编码对字符串的编码效果一样
        alert(encodeURI(test));
        alert(encodeURIComponent(test));
        //解码
        alert(decodeURI(encodeURI(test)));
        alert(decodeURIComponent(encodeURIComponent(test)));

        var test1 = "http://wwww.baidu.com";
        //这种编码 仍然和原来的一样
        alert(encodeURI(test1));
        alert(encodeURIComponent(test1));

        var  test2 = "alert('eval 以字符串中的的脚本语言执行')";
        alert(test2);
        eval(test2);

    </script>
</head>
<body>

</body>
</html>